/**
 * @Author: YCKOKO
 * @Date: 2023-05-18
 * @Time:10:36
 * @Description:
 */
public class demo2 {
    public boolean checkWon(int[][] board) {
        // write code here
        //水平方向
        for (int i =  0; i < board.length; i++) {
            int sum = 0;
            for (int j = 0; j < board[0].length; j++) {
                sum += board[i][j];
            }
            if (sum == 3) {
                return true;
            }
        }
        //垂直方向
        for (int i = 0; i < board[0].length; i++) {
            int sum = 0;
            for (int j = 0; j <  board.length; j++) {
                sum += board[j][i];
            }
            if (sum == 3) {
                return true;
            }
        }
        int sum = 0;
        //对角线方向
        for (int i = 0; i < board.length; i++) {
            sum += board[i][i];
        }
        if (sum == 3) {
            return true;
        }
        return false;
    }
}
